//
//  ToolViewController.m
//  必争医疗
//
//  Created by 毕成 on 14-11-20.
//  Copyright (c) 2014年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "ToolViewController.h"
#import "LogViewController.h"
@interface ToolViewController ()

@end

@implementation ToolViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self.view setBackgroundColor:[UIColor whiteColor]];
    self.navigationController.navigationBar.translucent = NO;
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"left.png"] style:UIBarButtonItemStyleDone target:self action:@selector(leftAction:)];
    [self.navigationItem setTitle:@"健康工具"];
    
    [self.tabBarController.tabBar setHidden:YES];
    
    [self creatScroll];
}

- (void)leftAction:(id)sender
{
    [self.navigationController popToRootViewControllerAnimated:YES];
}

- (void)creatScroll
{
    UIScrollView *scroll = [[[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height - 64)] autorelease];
    [scroll setContentSize:CGSizeMake(0, 1 * scroll.frame.size.height)];
    [scroll setBackgroundColor:[UIColor grayColor]];
    [self.view addSubview:scroll];
    
    UIView *first = [[[UIView alloc] initWithFrame:CGRectMake(5, 20, 365, 100)] autorelease];
    [first setBackgroundColor:[UIColor whiteColor]];
    [scroll addSubview:first];
    UIImageView *babyImage = [[[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 60, 80)] autorelease];
    [babyImage setImage:[UIImage imageNamed:@"baby.png"]];
    [first addSubview:babyImage];
    UILabel *babyTitle = [[[UILabel alloc] initWithFrame:CGRectMake(babyImage.frame.origin.x + babyImage.frame.size.width + 10, babyImage.frame.origin.y, 235, 40)] autorelease];
    [babyTitle setText:@"欧茜0-1岁育儿方案"];
    babyTitle.font = [UIFont fontWithName:nil size:18];
    [first addSubview:babyTitle];
    UILabel *babys = [[[UILabel alloc] initWithFrame:CGRectMake(babyTitle.frame.origin.x, babyTitle.frame.origin.y + babyTitle.frame.size.height, babyTitle.frame.size.width, 10)] autorelease];
    [babys setText:@"84249人在用"];
    babys.font = [UIFont fontWithName:nil size:12];
    [first addSubview:babys];
    UIImageView *babyNext = [[[UIImageView alloc] initWithFrame:CGRectMake(babyTitle.frame.origin.x + babyTitle.frame.size.width, 30, 40, 40)] autorelease];
    [babyNext setImage:[UIImage imageNamed:@"right.png"]];
    [first addSubview:babyNext];
    UIButton *baby = [[UIButton alloc] initWithFrame:CGRectMake(first.frame.origin.x, first.frame.origin.y, first.frame.size.width, first.frame.size.height)];
    [baby setBackgroundColor:[UIColor clearColor]];
    [baby addTarget:self action:@selector(logAction:) forControlEvents:UIControlEventTouchDragInside];
    [scroll addSubview:baby];
    
    
    UIView *second = [[[UIView alloc] initWithFrame:CGRectMake(5, first.frame.origin.y + first.frame.size.height + 20, 365, 100)] autorelease];
    [second setBackgroundColor:[UIColor whiteColor]];
    [scroll addSubview:second];
    UIImageView *girlImage = [[[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 60, 80)] autorelease];
    [girlImage setImage:[UIImage imageNamed:@"减肥"]];
    [second addSubview:girlImage];
    UILabel *girlTitle = [[[UILabel alloc] initWithFrame:CGRectMake(girlImage.frame.origin.x + girlImage.frame.size.width + 10, girlImage.frame.origin.y, 235, 40)] autorelease];
    [girlTitle setText:@"十二篮减肥：30天减6斤"];
    girlTitle.font = [UIFont fontWithName:nil size:18];
    [second addSubview:girlTitle];
    UILabel *girls = [[[UILabel alloc] initWithFrame:CGRectMake(girlTitle.frame.origin.x, girlTitle.frame.origin.y + girlTitle.frame.size.height, girlTitle.frame.size.width, 10)] autorelease];
    [girls setText:@"133399人在用"];
    girls.font = [UIFont fontWithName:nil size:12];
    [second addSubview:girls];
    UIImageView *girlNext = [[[UIImageView alloc] initWithFrame:CGRectMake(girlTitle.frame.origin.x + girlTitle.frame.size.width, 30, 40, 40)] autorelease];
    [girlNext setImage:[UIImage imageNamed:@"right.png"]];
    [second addSubview:girlNext];
    UIButton *girl = [[UIButton alloc] initWithFrame:CGRectMake(second.frame.origin.x, second.frame.origin.y, second.frame.size.width, second.frame.size.height)];
    [girl setBackgroundColor:[UIColor clearColor]];
    [girl addTarget:self action:@selector(logAction:) forControlEvents:UIControlEventTouchDragInside];
    [scroll addSubview:girl];
    
    
    UIView *third = [[[UIView alloc] initWithFrame:CGRectMake(5, second.frame.origin.y + second.frame.size.height + 20, 365, 100)] autorelease];
    [third setBackgroundColor:[UIColor whiteColor]];
    [scroll addSubview:third];
    UIImageView *runImage = [[[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 60, 80)] autorelease];
    [runImage setImage:[UIImage imageNamed:@"跑步.png"]];
    [third addSubview:runImage];
    UILabel *runTitle = [[[UILabel alloc] initWithFrame:CGRectMake(runImage.frame.origin.x + runImage.frame.size.width + 10, runImage.frame.origin.y, 235, 40)] autorelease];
    [runTitle setText:@"每天5000步"];
    runTitle.font = [UIFont fontWithName:nil size:18];
    [third addSubview:runTitle];
    UILabel *running = [[[UILabel alloc] initWithFrame:CGRectMake(runTitle.frame.origin.x, runTitle.frame.origin.y + runTitle.frame.size.height, runTitle.frame.size.width, 10)] autorelease];
    [running setText:@"3127人在用"];
    running.font = [UIFont fontWithName:nil size:12];
    [third addSubview:running];
    UIImageView *runNext = [[[UIImageView alloc] initWithFrame:CGRectMake(runTitle.frame.origin.x + runTitle.frame.size.width, 30, 40, 40)] autorelease];
    [runNext setImage:[UIImage imageNamed:@"right.png"]];
    [third addSubview:runNext];
    UIButton *run = [[UIButton alloc] initWithFrame:CGRectMake(third.frame.origin.x, third.frame.origin.y, third.frame.size.width, third.frame.size.height)];
    [run setBackgroundColor:[UIColor clearColor]];
    [run addTarget:self action:@selector(logAction:) forControlEvents:UIControlEventTouchDragInside];
    [scroll addSubview:run];

    
}

- (void)logAction:(id)sender
{
    LogViewController *log = [[LogViewController alloc] init];
    [self.navigationController pushViewController:log animated:YES];
}











- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
